home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / std / c++ / 808 < prev    next >
Encoding:
Internet Message Format  |  1996-08-06  |  2.5 KB

  1. Path: chronicle.mti.sgi.com!austern
  2. From: thp@cs.ucr.edu (Tom Payne)
  3. Newsgroups: comp.std.c++
  4. Subject: Re: Referencing pointers after delete
  5. Date: 21 Mar 1996 11:19:11 PST
  6. Organization: University of California, Riverside
  7. Approved: austern@isolde.mti.sgi.com
  8. Message-ID: <4is60i$ft6@galaxy.ucr.edu>
  9. References: <4is05t$ceo@engnews1.Eng.Sun.COM>
  10. NNTP-Posting-Host: isolde.mti.sgi.com
  11. X-Original-Date: 21 Mar 1996 18:09:22 GMT
  12. X-Newsreader: TIN [UNIX 1.3 950824BETA PL0]
  13. X-Auth: PGPMoose V1.1 PGP comp.std.c++
  14.     iQBVAwUBMVGrwUy4NqrwXLNJAQEkcQIAiE4YCLheIHih3c+w5NtfJpOly/eLUuiH
  15.     dCUcvI6m1UZ6KhkvAs3T3jNM9DlaX9+LbX6m/BDE3DjOaOwYnX+0XA==
  16.     =CrZA
  17. Originator: austern@isolde.mti.sgi.com
  18.  
  19. joe (j.) halpin (jhalpin@bnr.ca) wrote:
  20. : To Moderator: This may be a duplicate, my newsreader software was having
  21. : trouble sending this, so I'm mailing it as well.
  22. : In 3.7.3.2.4 the January working paper says:
  23. : 4 A deallocation function can free the storage referenced by the pointer
  24. :   given  as  its  argument and renders the pointer invalid.  The storage
  25. :   can be made available for further allocation.  An invalid pointer con-
  26. :   tains an unusable value:  it cannot even be used in an expression.
  27. [...]
  28. : Am I misunderstanding something, or is it illegal to zero out pointers
  29. : after they've been deallocated? I'm assuming that the intent was to
  30. : disallow dereferencing of pointers that have been handed to
  31. : delete. The wording seems to disallow the above as well.
  32. :
  33. : In fact, it sounds like it also rules out things like 'if(pc == 0)
  34. : ...' after the above fragment.
  35.  
  36. Apparently there are architectures (80386?) that perform such validity
  37. checks on read access to pointer registers and trap on certain bogus
  38. values.  So, the standard deems that after deallocation a pointer
  39. object might contain a value that is so bogus that even reading it
  40. will provoke "undefined behavior" and assigning the pointer a valid
  41. value is the only valid operation.  It seems that to accomodate
  42. certain hardware-based validity checkers for pointers, the standard
  43. has precluded the possibility of portable software-based validity
  44. checking.  IMHO an unfortunate decision.
  45.  
  46. Tom Payne (thp@cs.ucr.edu)
  47. ---
  48. [ comp.std.c++ is moderated.  To submit articles: Try just posting with your 
  49.                 newsreader.  If that fails, use mailto:std-c++@ncar.ucar.edu
  50.   comp.std.c++ FAQ: http://reality.sgi.com/austern/std-c++/faq.html
  51.   Moderation policy: http://reality.sgi.com/austern/std-c++/policy.html
  52.   Comments? mailto:std-c++-request@ncar.ucar.edu 
  53. ]
  54.